﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace SharpIM.Http
{
    public class JsonResult : IHttpResult
    {
        public JsonResult()
        {
            this.ContentType = "application/json";
        }
        public object Data { get; set; }
        public string ContentType { get; set; }
        public ResponseStream ToResponseStream()
        {
            if (Data == null)
            {
                return new ResponseStream("");
            }
            var str = JsonConvert.SerializeObject(Data);
            return new ResponseStream(str);
        }
    }
}
